<template>
  <div class="adv-comp">
    <KSwiper style="height:100%" v-model="currentIndex" :autoplay="true" :interval="10000" :circular="true" :indicator-dots="true">
      <KSwiperItem v-for="imgUrl in imgUrls" :key="imgUrl.id" :item-id="imgUrl.id">
        <KView class="adv-comp-item">
          <img class="sys-img" :src="imgUrl.imgUrl" mode="aspectFit" @click="itemClick(imgUrl)">
        </KView>
      </KSwiperItem>
    </KSwiper>
  </div>
</template>

<script>
  export default {
    props: {
      imgUrls: {
        type: Array,
        required: true
      }
    },

    data() {
      return {
        currentIndex: 0
      };
    },

    methods: {
      itemClick(imgUrl) {
        this.$emit('item-clcik', imgUrl);
      }
    }
  };

</script>

<style lang="scss">
  .adv-comp {
    width: 100%;
    height: 100%;

    .adv-comp-item {
      width: 100%;
      height: 100%;
      overflow: hidden;
    }
  }

</style>
